package com.bml.architect.proivder.service;

import com.bml.architect.DemoService;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.config.annotation.Service;
import org.apache.dubbo.rpc.RpcContext;

@Service(version = "default")
public class DemoServiceImpl implements DemoService {
    @Override
    public String sayHello(String name) {
        System.out.println("执行了默认的服务 "+ name);

        try {
            Thread.sleep(10);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        URL url = RpcContext.getContext().getUrl();
        return String.format("%s:%s,hello,%s",url.getProtocol(),url.getPort(),name);
    }
}
